package main

import "fmt"

func main() {

	//test1()
	//test2()
	test3()
}

func test1() {
	var thing [5]struct{}
	for v := range thing {
		defer fmt.Println(v)
	}
}

func test2() {
	var whatever [5]struct{}
	for i := range whatever {
		defer func() { fmt.Println(i) }()
	}
}

type Test struct {
	name string
}

func (t *Test) Close() {
	fmt.Println(t.name, " closed")
}
func test3() {
	ts := []Test{{"a"}, {"b"}, {"c"}}
	for _, t := range ts {
		defer t.Close()
	}
}
